var Page = function(){
    this.init();
};
Page.prototype = {
    params: {
        passport: '',
        sendId:''
    },
    init: function(){
        this.initParams();
        this.initEvent();
    },
    initParams: function(){
        this.params.passport = Pub.getCookie('_PASSPORT');
        this.params.sendId = Pub.getSession('sendId');
    },
    getData: function(){
        var _this = this;
        var paramsObj = {
            passport: _this.params.passport,
            sendId:_this.params.sendId
        };
        Api.messagesenddetails(paramsObj, function(data){
            console.log(data);
            $('#typeName').text(data.data.typeName);
            $('#content').val(data.data.content);
        });
    },
    otherEvent:function(){
        var _this = this;
        $('#btn_submit').click(function(event) {
            var content=$('#content').val();
            var paramsObj = {
                passport: _this.params.passport,
                sendId:_this.params.sendId,
                content:content
            };
            Api.messagesendmodify(paramsObj, function(data){
                console.log(data);
                layui.use('layer', function(){
                    layer.msg('编辑成功', {icon: 6});
                    setTimeout(function(){
                        window.location.href = Pub.getHtmlUrl('./message-remind.html');
                    },1500)
                });
            });
        });
    },
    initEvent: function(){
        var _this = this;
        _this.getData();
        _this.otherEvent();


    }
};
var page = new Page();